package com.vilen.weather.v_learn_firstcode.app.L_2;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by vilen on 2015/5/28.
 * 统一管理Activity
 */
public class ActivityCollector {
    public static List<Activity> activities = new ArrayList<Activity>();
    public static void addActivity(Activity activity) {
        activities.add(activity);
    }
    public static void removeActivity(Activity activity) {
        activities.remove(activity);
    }
    //随时退出程序
    public static void finishAll(){
        for (Activity activity:activities){
            if(!activity.isFinishing()){
                activity.finish();
            }
        }
    }
}
